<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>使用百分比来设置元素的宽度</title>
    <style>
        img.normal {
            width: auto;
        }

        img.big {
            width: 50%;
        }

        img.small {
            width: 10%;
        }
    </style>
</head>

<body>
    <img class="normal" src="https://www.runoob.com/try/demo_source/logocss.gif" width="95" height="84" /><br>
    <img class="big" src="https://www.runoob.com/try/demo_source/logocss.gif" width="95" height="84" /><br>
    <img class="small" src="https://www.runoob.com/try/demo_source/logocss.gif" width="95" height="84" />
</body>

</html>